package bjyTaxi;

public class BjyTaxiPrice {

    private double pricePerMile = 0.8;

    private double distanceLimit = 8;

    private double waitingPerMin = 0.25;

    private double rate = 0.5;


    public int getTaxiPrice(double distance, double waitingTime){
        double price = 0;
        double distancePrice = 0;
        double waitingPrice = 0;
        if(distance <= distanceLimit){
            distancePrice = pricePerMile*distance + distancePrice;
        }else {
            distancePrice = pricePerMile*distanceLimit + (distance-distanceLimit)*(pricePerMile*rate+pricePerMile);
        }
        if(waitingTime!=0){
            waitingPrice = waitingPrice + waitingTime * waitingPerMin;
        }
        price = waitingPrice+ distancePrice
        return (int) Math.round(price);
    }

    public static void main(String[] args) {
        System.out.println(new BjyTaxiPrice().getTaxiPrice(11,2));
    }
}
